<template>
  <div class="app-container">
    <trailProject v-if="proType == '1'" :viewType="viewType" :form="form" />
    <Declare v-if="proType == '2'" :viewType="viewType" :form="form" />
    <SignUp v-if="proType == '3'" :viewType="viewType" :form="form" />
  </div>
</template>

<script>
import trailProject from '../components/trailProject.vue';
import Declare from '../components/declare.vue';
import SignUp from '../components/signUp.vue';
import { getTrailProject, getDeclareProject, getSignProject } from '@/api/project/index';
export default {
  components: {
    trailProject,
    Declare,
    SignUp
  },
  name: "projectAdd",
  data() {
    return {
      form: {}
    };
  },
  computed: {
    proType() {
      return this.$route.query.proType;
    },
    viewType() {
      return this.$route.query.viewType;
    },
    proId() {
      return this.$route.query.proId;
    }
  },
  created() {
    if(this.proId) {
      this.getProjectDetails()
    }
  },
  methods: {
    getProjectDetails() {
      let url = this.proType == '1' ? getTrailProject : this.proType == '2' ? getDeclareProject : getSignProject; 
      url(this.proId).then(response => {
        if(response.code == 200) {
          this.form = response.data;
        }
      });
    }
  }
};
</script>
<style scoped lang="scss"></style>